Public Class Table
    Inherits ColumnList

    Private _TableName As String
    Private _PKColumnName As String
    Private _ParentTableName As String
    Private _GenerateDefaultConstructor As Boolean = True

    Public Property TableName() As String
        Get
            Return Me._TableName
        End Get
        Set(ByVal Value As String)
            Me._TableName = Value
        End Set
    End Property

    Public Property ParentTableName() As String
        Get
            Return Me._ParentTableName
        End Get
        Set(ByVal Value As String)
            Me._ParentTableName = Value
        End Set
    End Property

    Public Property PKColumnName() As String
        Get
            Return Me._PKColumnName
        End Get
        Set(ByVal Value As String)
            Me._PKColumnName = Value
            Dim col As Column = Me.Columns(Value)
            If Not col Is Nothing Then
                col.PrimaryKey = True
            End If
        End Set
    End Property

    Public Property GenerateDefaultConstructor() As Boolean
        Get
            Return Me._GenerateDefaultConstructor
        End Get
        Set(ByVal value As Boolean)
            Me._GenerateDefaultConstructor = value
        End Set
    End Property

    Public Sub AddColumn(ByVal col As Column)
        Me.Add(col)
    End Sub

    Public ReadOnly Property ColumnCount() As Integer
        Get
            Return Me.Count
        End Get
    End Property

    'Public ReadOnly Property Columns() As Integer
    '    Get
    '        Return Me.Count
    '    End Get
    'End Property

    Public Overrides Function ToString() As String
        Dim out As String = ""
        out = out & Me._TableName & " [" & Me._PKColumnName & "]" & vbCrLf & "-----------" & vbCrLf
        For i As Integer = 0 To Me.Count - 1
            out = out & Me(i).ToString() & vbCrLf
        Next
        Return out
    End Function
End Class
